package week4.num.ExceptionDemo01.utilityTest;

import java.util.Scanner;

public class GetCount {
    public static void main(String[] args) {
        /**
         * 创建键盘录入对象
         */
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入一字符串");
        //创建字符串接收键盘录入的值
        String str= sc.nextLine();
        //将字符串转化为字符数组
        char[] charArray = str.toCharArray();
        //创建变量记录字符出现次数
        int count=0;
        for (int i = 0; i < charArray.length; i++) {
            if (charArray[i]=='e'){
                count++;
            }
        }
        System.out.println("字符e出现的次数为:"+count);
    }
}
